package cn.service.impl;

import cn.dao.GoodsDao;
import cn.entity.Goods;
import cn.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class GoodsServiceImpl implements GoodsService{
	@Autowired
	GoodsDao goodsDao;
	@Override
	public int deleteByPrimaryKey(Object id) {
		return goodsDao.deleteByPrimaryKey(id);
	}

	@Override
	public int insert(Goods record) {
		return goodsDao.insert(record);
	}

	@Override
	public Goods selectByPrimaryKey(Object id) {
		return goodsDao.selectByPrimaryKey(id);
	}

	@Override
	public int updateByPrimaryKey(Goods record) {
		return goodsDao.updateByPrimaryKey(record);
	}

	@Override
	public List<Goods> find(Object kid,String name) {
		List<Goods> list=new ArrayList<Goods>();
		try{
			Map<String, Object> params=new HashMap<String, Object>();
			params.put("kid", kid);
			params.put("name", name);
			list=goodsDao.find(params);
		}catch(Exception ex){
			ex.printStackTrace();
		}
		return list;
	}

}
